﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;

namespace WandaSolution.GoogleMap
{
    public partial class GoogleMapUserControl : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                using (SPWeb spw = SPContext.Current.Web)
                {
                    SPList spl = spw.Lists["酒店基本信息管理"];

                    if (spl.ItemCount > 0)
                    {
                        SPListItem item = spl.Items[0];
                        map_canvas.Style["width"] = item["地图宽度"].ToString();
                        map_canvas.Style["height"] = item["地图高度"].ToString();
                        map_canvas.Attributes["lat"] = item["纬度"].ToString();
                        map_canvas.Attributes["lng"] = item["经度"].ToString();
                        map_canvas.Attributes["zoomlevel"] = item["地图缩放"].ToString();
                    }
                }
            }
        }
    }
}
